package com.cg.design.depthdesign.builder;

import com.cg.design.depthdesign.builder.builders.CarBuilder;
import com.cg.design.depthdesign.builder.builders.CarManualBuilder;
import com.cg.design.depthdesign.builder.cars.Car;
import com.cg.design.depthdesign.builder.cars.Manual;
import com.cg.design.depthdesign.builder.director.Director;

/**
 * 创建型模式：Builder建造者模式测试类
 *
 * @program: LeetCode->BuilderTest
 * @author: cg
 * @create: 2022-05-08 16:21
 **/
public class BuilderTest {

    public static void main(String[] args) {
        Director director = new Director();
        CarBuilder builder = new CarBuilder();
        director.constructSportsCar(builder);

        Car car = builder.getResult();
        System.out.println("Car built:\n" + car.getCarType());

        CarManualBuilder manualBuilder = new CarManualBuilder();

        director.constructSportsCar(manualBuilder);
        Manual manual = manualBuilder.getResult();
        System.out.println("\nCar manual built:\n" + manual.print());
    }

}
